import json
import ssl
import requests

ssl._create_default_https_context = ssl._create_unverified_context
url = r"https://api.powerbi.com/beta/e96fa72b-c8d6-4957-96bd-c7f8dc30cc88/datasets/31fb02b8-3e95-4bec-b9b2-5af9c0d67aa0/rows?experience=power-bi&key=28Ri5RxnC5wvZFax5umuUDI2FZi6LxZ6q1bZPLqtfNfSXkLIuxqvge6bkETamwjdYIo%2F0EP8sgoAVzi55wI2Dw%3D%3D"
headers = {
        "Content-Type": "application/json"
    }


def send_monitoring_data(data):
    try:
        response = requests.post(url, data=json.dumps(data), headers=headers, verify=False)
        # response.raise_for_status()  # 检查请求是否成功
        print(response.status_code)
        # print(response.text)
    except requests.exceptions.RequestException as e:
        print("Error sending monitoring data:", str(e))
